/* eslint-disable prettier/prettier */
import React, { useRef, useEffect, useState } from 'react';
import { View, TouchableOpacity, Text, Image, ActivityIndicator } from 'react-native';
import styles from './styles';
import { GifControllerView } from 'react-native-gif-controller-view';
import SoundPlay from './soundplay';
import { store } from '../../store/store';
const  AsyncChildComponent = ({gifSource,height,isAnimating,gifRef})=> {
  const [gifSource1, setGifSource] = useState(null);
  const [height1, setHeight] = useState(200);
  const [isAnimating1, setIsAnimating] = useState(false); 
  useEffect(() => {
   setGifSource(gifSource);
   setHeight(height);
   setIsAnimating(isAnimating);
  }, [gifSource,isAnimating]);
    return (
      
       gifSource1 === null ? null:(
        <View>
        <GifControllerView
                source={{ uri: gifSource1 }}
                style={{
                  justifyContent: 'center',
                  resizeMode: 'cover',
                  alignItems: 'center',
                  width: 200,
                  height: height,
                }}
                isAnimating={isAnimating1}
                isReverse={false}
                speed={1}
                ref={gifRef}
              />
      </View>)
    );
  };
  export default AsyncChildComponent;
